﻿@using SapaFinance.DTO
@using SapaFinance.UI.Controllers
@using Telerik.Web.Mvc.UI
@model IEnumerable<BankDTO>
@{
    Layout = "~/Views/Shared/_Submenu.cshtml";
}
<h2>
    Список банков</h2>
<div>
    @(Html.Telerik().Grid(Model)
               .Name("Grid")
               .DataKeys(keys => { keys.Add(o => o.UID); })
               .ToolBar(commands => commands.Insert())
               .Columns(columns =>
                        {
                            columns.Bound(o => o.UID).Visible(false);
                            columns.Bound(o => o.Bin);
                            columns.Bound(o => o.Name);
                            columns.Bound(o => o.CorrespondentAccount);
                            columns.Bound(o => o.City);
                            columns.Bound(o => o.Address);
                            columns.Bound(o => o.Swift);
                            columns.Command(commands =>
                                            {
                                                commands.Edit();
                                                commands.Delete();
                                            });
                        })
               .DataBinding(dataBinding => dataBinding.Server()
                                               .Select<BankController>(x => x.Index())
                                                       .Insert("Insert", "Bank")
                                                       .Update("Update", "Bank")
                                                       .Delete("Delete", "Bank")
               )
               .Sortable(sorting => sorting.Enabled(true))
               .Selectable(x => x.Enabled(true))
                       .Editable(x => x.Enabled(true).Mode(GridEditMode.PopUp).Window(p => p.ClientEvents(z => z.OnOpen("CenterPopupWindow")))))
</div>
